import time
from collections import Iterable

d = {'Michael': 95, 'Bob': 75, 'Tracy': 85}

print(d['Bob'])

if 'Tracy' in d:
    print("yes")
else:
    print("No")

print(d.get('Bob'))
print(d.get('Bobs'), -1)

s = {1, 3, 2, 3, 4}  # set

print(s)

dict1 = {'a': 1, 'b': 2, 'c': 3}

for key in dict1:
    print("%s, %d" % (key, dict1[key]))

if dict1.get('d'):
    print("d is exist")
else:
    print("d is not exist", dict1.get('d'))
'''
a, 1
b, 2
c, 3
'''

print(isinstance('abcde', Iterable))  # True
print(isinstance([1, 2, 4], Iterable))  # True
print(isinstance(123, Iterable))  # False

for x, y in [(1, 1), (2, 4), (3, 9)]:
    print(x, y)
'''
1 1
2 4
3 9
'''

d = {'x': 'A', 'y': 'B', 'z': 'C'}
print([k + '=' + v for k, v in d.items()])  # ['x=A', 'y=B', 'z=C']


headers = {

        'Accept': 'application/json',
        'Accept-Language': 'en,zh-CN;q=0.9,zh;q=0.8',
        'Connection': 'keep-alive',
        'Content-Length': '62',
        'Content-Type': 'application/x-www-form-urlencoded',
        'Host': 'accounts.douban.com',
        'Origin': 'https://accounts.douban.com',
        'Referer': 'https://accounts.douban.com/passport/login',
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) '
                      'Chrome/81.0.4044.122 Safari/537.36',
        'X-Requested-With': 'XMLHttpRequest',
        'Cookie': 'bid=OFhomegA5fY; __utmc=30149280; douban-fav-remind=1; apiKey=; user_data={%22area_code%22:%22+86%22%2C%22number%22:%2218601087269%22%2C%22code%22:%223954%22}; vtoken=undefined; push_noty_num=0; __utmv=30149280.7258; douban-profile-remind=1; push_doumail_num=0; last_login_way=account; ll="108288"; __utmz=30149280.1587949995.6.2.utmcsr=accounts.douban.com|utmccn=(referral)|utmcmd=referral|utmcct=/passport/login; ap_v=0,6.0; __utma=30149280.793823606.1587868272.1587952152.1587967834.8; _pk_ref.100001.2fad=%5B%22%22%2C%22%22%2C1587967847%2C%22https%3A%2F%2Fwww.douban.com%2Fdoumail%2F%22%5D; ps=y; _pk_id.100001.2fad=029d56dd77fceb36.1587868808.5.1587968424.1587949982.; '
                  'login_start_time=',
    }
login_start_time = int(time.time() * 1000)
headers['Cookie'] = headers['Cookie'] + str(login_start_time)
print(headers)
